package cn.lsnu.modules.check.service;

import cn.lsnu.common.interfacetools.interfaceentity.Page;
import cn.lsnu.common.interfacetools.interfaceservice.BaseService;
import cn.lsnu.modules.check.entity.CheckTaskEntity;
import cn.lsnu.modules.check.mapper.CheckTaskMapper;
import cn.lsnu.utils.Global;
import cn.lsnu.utils.Guuid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CheckTaskService extends BaseService<CheckTaskEntity,CheckTaskMapper> {

    @Autowired
    private CheckTaskMapper checkTaskMapper;

    @Override
    public void save(CheckTaskEntity entity) throws Exception {
        entity.setTaskId(Guuid.uuid());
        entity.setTaskTime(new Date());
        entity.setStatus("0");
        super.save(entity);
    }

    @Override
    public CheckTaskEntity get(String key) throws Exception {
        return super.get(key);
    }

    @Override
    public CheckTaskEntity getEntity(CheckTaskEntity entity) throws Exception {
        return super.getEntity(entity);
    }

    @Override
    public List<CheckTaskEntity> findList(CheckTaskEntity entity) throws Exception {
        return super.findList(entity);
    }

    @Override
    public Page<CheckTaskEntity> findPage(CheckTaskEntity entity) throws Exception {
        return super.findPage(entity);
    }

    @Override
    public void delete(CheckTaskEntity entity) throws Exception {
        super.delete(entity);
    }

    @Override
    public void update(CheckTaskEntity entity) throws Exception {
        super.update(entity);
    }

    public List<CheckTaskEntity> addressCount(CheckTaskEntity entity) throws Exception{

        return  checkTaskMapper.addressCount(entity);
    }

    public void updateStatus(CheckTaskEntity entity)throws Exception{
        checkTaskMapper.updateStatus(entity);
    }
}
